import Vue from 'vue'
import App from './App.vue'
import VueRouter from 'vue-router'
import store from './store'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css';
import Home from '@/views/home/Home.vue'
import HomeContent from '@/views/home/components/HomeContent.vue'
import Diy from '@/views/diy/Diy.vue'
import Login from '@/views/login/Login.vue'
import Register from '@/views/login/Register.vue'
import Cart from '@/views/cart/Cart.vue'
import Order from '@/views/order/Order.vue'
import GoodsManagement from '@/views/goodsManagement/GoodsManagement.vue'
import OrderManagement from '@/views/orderManagement/OrderManagement.vue'
import UserManagement from '@/views/userManagement/UserManagement.vue'

Vue.use(VueRouter)
Vue.use(ElementUI)

console.log('store', store)

const router = new VueRouter({
  routes: [
    { path: '/', redirect:'/login' },
    { path: '/login', component: Login },
    { path: '/register', component:Register },
    { 
      path: '/home', 
      component: Home,
      children: [
        {path: '', component: HomeContent},
        {path: 'diy/:index', component: Diy},
        {path: 'cart', component: Cart},
        {path: 'order', component: Order},
        {path: 'user-management', component: UserManagement},
        {path: 'goods-management', component: GoodsManagement},
        {path: 'order-management', component: OrderManagement},
      ]
    }
  ]
})


Vue.config.productionTip = false

new Vue({
  router,
  store,
  render: h => h(App),
}).$mount('#app')
